
//
//  HMTarbarController.m
//  weiboOC
//
//  Created by 刘耀宗 on 16/4/8.
//  Copyright © 2016年 刘耀宗. All rights reserved.
//

#import "HMTarbarController.h"
#import "HMProVC.h"
#import "HMDisVC.h"
#import "HMHomeVC.h"
#import "HMMessageVC.h"
#import "HMTabbar.h"
@implementation HMTarbarController
-(void)viewDidLoad
{
    [super viewDidLoad];
    HMTabbar *tabbar=[[HMTabbar alloc] init];
//    self.tabBar=tabbar;
    [self setValue:tabbar forKey:@"tabBar"];
    [self setTabbar];
    
 

}
-(void)setTabbar
{
//    self
    [self addChildVC:[[HMHomeVC alloc] init] andTitle:@"首页" andImage:[UIImage imageNamed:@"tabbar_home"]];
    [self addChildVC:[[HMMessageVC alloc] init] andTitle:@"消息" andImage:[UIImage imageNamed:@"tabbar_message_center"]];
    [self addChildVC:[[HMDisVC alloc] init] andTitle:@"发现" andImage:[UIImage imageNamed:@"tabbar_profile"]];
  
    [self addChildVC:[[HMProVC alloc] init] andTitle:@"我" andImage:[UIImage imageNamed:@"tabbar_profile"]];
  


}
-(void)addChildVC:(UITableViewController *)tableViewVC andTitle:(NSString *)title andImage:(UIImage *)image
{
    //包一个导航控制器
    UINavigationController *navVC=[[UINavigationController alloc] initWithRootViewController:tableViewVC];
    
    [self addChildViewController:navVC];
    tableViewVC.tabBarItem.title=title;
    tableViewVC.tabBarItem.image=image;
    tableViewVC.title=title;
    
}

@end
